﻿//Created by Action Script Viewer - http://www.buraks.com/asv
package Display.hud.components {
    import flash.events.*;
    import flash.display.*;
    import org.aswing.*;
    import Classes.*;
    import flash.filters.*;
    import Display.*;
    import Display.aswingui.*;
    import Display.peddlerUI.*;

    public class HUDPeddlerComponent extends HUDComponent {

        protected var m_peddlerHolder:JPanel;
        private var m_peddlerUI:PeddlerBar;

        override protected function buildComponent():void{
            m_jPanel = ASwingHelper.makeSoftBoxJPanelVertical(SoftBoxLayout.CENTER, 0);
            var _local1:DisplayObject = (new EmbeddedArt.peddlerIcon() as DisplayObject);
            this.m_peddlerHolder = ASwingHelper.makeSoftBoxJPanel(SoftBoxLayout.LEFT);
            ASwingHelper.setSizedBackground(this.m_peddlerHolder, _local1);
            this.m_peddlerHolder.addEventListener(MouseEvent.CLICK, this.onMouseClick);
            this.m_peddlerHolder.addEventListener(MouseEvent.MOUSE_MOVE, this.onMouseMove);
            this.m_peddlerHolder.addEventListener(MouseEvent.MOUSE_OUT, this.onMouseOut);
            m_jPanel.append(ASwingHelper.verticalStrut(5));
            m_jPanel.append(this.m_peddlerHolder);
            if (((Global.peddlerManager) && (Global.peddlerManager.hasPeddlers()))){
                this.visible = true;
            } else {
                this.visible = false;
            };
        }
        override protected function attachToolTip():void{
            m_toolTip = new ToolTip(function ():String{
                return (ZLoc.t("Dialogs", "peddlerToolTip"));
            });
            m_toolTip.attachToolTip(this.m_peddlerHolder);
            m_toolTip.hideCursor = true;
        }
        private function onMouseMove(_arg1:MouseEvent):void{
            this.m_peddlerHolder.buttonMode = true;
            this.m_peddlerHolder.useHandCursor = true;
            var _local2:GlowFilter = new GlowFilter(EmbeddedArt.HOVER_GLOW_COLOR, 1, 8, 8, 5);
            this.m_peddlerHolder.filters = [_local2];
        }
        private function onMouseOut(_arg1:MouseEvent):void{
            this.m_peddlerHolder.buttonMode = false;
            this.m_peddlerHolder.useHandCursor = false;
            this.m_peddlerHolder.filters = [];
        }
        private function onMouseClick(_arg1:MouseEvent):void{
            PeddlerBar.getInstance().setSelectorData(Global.peddlerManager.peddlers);
            PeddlerBar.getInstance().setUpDataForBar();
        }

    }
}//package Display.hud.components 
